# Autor: Demian Ferreiro
# A very stupid makefile xD

auxfiles = $(shell find . -name '*\.aux')
tocfiles = $(shell find . -name '*\.toc')
logfiles = $(shell find . -name '*\.log')

# Not stop on errors.
texflags = -interaction=nonstopmode

# Uncomment to supress the fu***** pdflatex command.
quiet = yes

ifdef quiet
texflags += > /dev/null
endif 


.PHONY = all clean

all : TABLAS.png Informe.pdf DER.png DER.pdf

Informe.pdf : Informe.org TABLAS.png DER.png Queries.org
	emacs -batch --visit=Informe.org -l ~/.emacs --funcall org-export-as-pdf

DER.pdf : DER.tex
	pdflatex $(texflags) DER.tex

DER.png : DER.pdf
	convert -trim -density 300 DER.pdf DER.png

TABLAS.png : TABLAS.svg
	convert -trim -density 300 TABLAS.svg TABLAS.png

clean :
	@rm -vf $(auxfiles) $(tocfiles) $(logfiles) 
	@rm -vf TABLAS.png Informe.pdf DER.pg DER.pdf
